package cn.edu.sdjzu.cs.dingcan.service;

import java.sql.SQLException;
import java.util.List;

import cn.edu.sdjzu.cs.dingcan.dao.FoodDao;
import cn.edu.sdjzu.cs.dingcan.entity.Food;
import cn.edu.sdjzu.cs.dingcan.utils.PageBean;

/**
 * 菜品服务类
 * 
 * 
 */
public class FoodService {

	private final FoodDao foodDao;

	public FoodService() {
		this.foodDao = new FoodDao();
	}

	public void add(Food food) throws SQLException {
		this.foodDao.add(food);
	}

	public void delete(int id) throws SQLException {
		this.foodDao.delete(id);
	}

	public void update(Food food) throws SQLException {
		foodDao.update(food);
	}

	public Food getById(Long id) throws SQLException {
		return foodDao.findById(id);
	}

	public Food getByName(String name) throws SQLException {
		return this.foodDao.findByName(name);
	}

	public List<Food> query(String keyword) throws SQLException {
		return foodDao.query(keyword);
	}

	public List<Food> findByType(Long foodTypeId) throws SQLException {
		return foodDao.findByType(foodTypeId);
	}

	public List<Food> getAll() throws SQLException {
		return this.foodDao.getAll();
	}
	public void getAll(PageBean<Food> pageBean) throws SQLException {
		this.foodDao.getAll(pageBean);
	}
}
